package com.fy.service.imbusiness.controller;


import com.alibaba.fastjson.JSONObject;
import com.fy.service.service.SkImUserBacklistService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fy.framework.common.model.R;
import com.fy.common.entity.SkImUserBacklist;
import com.fy.common.model.PageRequest;
import com.fy.common.dto.UserBlackListPullDto;

import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 用户黑名单
 *
 * @author zhshuo
 * @date 2021/12/02 16:26
 **/
@Slf4j
@RestController
@AllArgsConstructor
@Api(tags = "用户黑名单相关功能")
@RequestMapping("/user/blackList")
public class SkImUserBlackListController {

    SkImUserBacklistService imUserBacklistService;

    /**
     * 黑名单列表
     *
     * @param pageRequest 黑名单分页请求
     * @return {@link R }
     */
    @PostMapping("/list")
    @ApiOperation(value = "黑名单列表")
    public R<?> blackList(@RequestBody PageRequest<SkImUserBacklist> pageRequest) {
        return imUserBacklistService.blackList(pageRequest);
    }

    /**
     * 进行拉黑
     * @return {@link R }
     */
    @PostMapping("/pull")
    @ApiOperation(value = "拉黑")
    public R<?> pull(@RequestBody UserBlackListPullDto userBlackListPullDto ){
        return imUserBacklistService.pullBlackList(userBlackListPullDto);
    }

    /**
     * 取消拉黑
     * @return {@link R }
     */
    @PostMapping("/cancel")
    @ApiOperation(value = "取消拉黑")
    @ApiParam(name = "blackId",value = "拉黑数据项ID")
    public R<?> cancel(@RequestBody JSONObject param){
        return imUserBacklistService.cancel(param);
    }

}
